<template>
  <div id="root">
    <BetDetailHeader :lastLotts="lastLotts" :lastLottList="lastLottList"/>
    <div class="bet_1">
      <van-tabs v-if="model" v-model="active">
        <van-tab title="大小骰宝">
          <div class="tabPane" :style="this.chooseBet.length > 0? 'height:320px': 'height:400px'">
            <BetRow ref="threeBigSmall" title="三军大小" rowNum="3" :betRows="betRows"  @chooseBetNum="chooseBetNum"></BetRow>
            <BetRow ref="rollOrRolls" title="围骰全骰" rowNum="2" :betRows="betRows2" @chooseBetNum="chooseBetNum"></BetRow>
          </div>
        </van-tab>
        <van-tab title="鱼虾蟹骰宝">

        </van-tab>
      </van-tabs>
      <div v-if="!model" class="bet_1_mode2" >
        <van-tabs >
          <van-tab title="遗漏">
            <div class="yilou">
              <div class="space"></div>
              <div class="item_wrap" v-for="(item, index) in yilouList">
                <div class="up">
                  <div class="show_name">三军 - 5</div>
                  <div class="off_count">
                    <span class="n">5</span>期未开
                  </div>
                  <div class="btn" @click="betInput(index)">下注</div>
                </div>
                <div class="down" :style="betDownShow == index? 'height: 48px;' : 'height: 0px;'">
                  <div class="odds">赔率:<span class="n">1.984</span>
                  </div>
                  <input class="input" type="tel" maxlength="4" placeholder="输入金额"/>
                  <div class="btn_wrap">
                    <div class="btn1" @click="betInput(-1)">取消</div>
                    <div class="btn2" @click="">确认</div>
                  </div>
                </div>
              </div>
            </div>
          </van-tab>
        </van-tabs>
      </div>

      <div class="footer_ct">
        <div class="default" :style="chooseBet.length > 0?'display: none' : 'display: flex'">
          <div class="left">
            <div class="balance_wrap">
              <div class="balance">余额:<span>0.00</span>元</div>
              <div class="win_lost">
                <div class="label">今日输赢:</div>
                <div class="num" style="color: rgb(126, 179, 121);">0</div>元
              </div>
            </div>
            <div class="refresh">
              <img class="img" :src="require('../../assets/images/icon/refresh.png')"/>
            </div>
            <div class="need_login" :style="'display:none'">请先登录/注册</div>
          </div>
          <div class="right">
            <div class="submit">
              <img class="phone_shake" :src="require('../../assets/images/icon/suijiyizhu.png')">
            </div>
            <div class="shopping_cart">
              <img class="shop_purple" :src="require('../../assets/images/icon/shopping.png')">
            </div>
          </div>
        </div>
        <div class="active" :style="chooseBet.length == 0?'display: none' : ''">
          <div class="message">
            <div class="order_message">{{chooseBet.length}}注{{chooseBet.length * selectedItem}}元</div>
            <div class="account_message">余额0元</div>
          </div>
          <div class="tool">
            <div class="edit">
              <img src="" class="icon"/>
              <div class="shortcut_editor" style="display: none">
                <div class="editor">
                  <div class="top">
                    <div class="shortcut_amount">
                      <div class="item"><input type="tel" class="input" maxlength="5" value="5"></div>
                      <div class="item"><input type="tel" class="input" maxlength="5" value="10"></div>
                      <div class="item"><input type="tel" class="input" maxlength="5" value="15"></div>
                      <div class="item"><input type="tel" class="input" maxlength="5" value="30"></div>
                      <div class="item"><input type="tel" class="input" maxlength="5" value="90"></div>
                    </div>
                  </div>
                  <div class="tips">点击金额框可以自定义金额</div>
                  <div class="bottom">
                    <div class="cancel">取消</div>
                    <div class="confirm">确认</div>
                  </div>
                </div>
              </div>
            </div>
            <div class="content">
              <div :class="selectedItem == 5? 'item_act' :'item'" @click="selectedItemClick(5)">5</div>
              <div :class="selectedItem == 10? 'item_act' :'item'" @click="selectedItemClick(10)">10</div>
              <div :class="selectedItem == 15? 'item_act' :'item'" @click="selectedItemClick(15)">15</div>
              <div :class="selectedItem == 30? 'item_act' :'item'" @click="selectedItemClick(30)">30</div>
              <div :class="selectedItem == 90? 'item_act' :'item'" @click="selectedItemClick(90)">90</div>
            </div>
            <div class="add">加入注单</div>
          </div>
          <div class="bar">
            <div class="input_wrap">
              <input class="input" type="tel" maxlength="6" placeholder="输入金额" :value="selectedItem">元
            </div>
            <div class="clean" @click="cancelBet">清空</div>
            <div class="submit">确认</div>
          </div>
        </div>
      </div>
      <DownBet />
    </div>
  </div>

</template>

<script>
  import BetRow from "./BetRow";
  import BetDetailHeader from "./BetDetailHeader";
  import DownBet from "components/DownBet";

    export default {
        name: 'backHeader',
        components: {
          BetRow,
          BetDetailHeader,
          DownBet
        },
        props: ['title'],
        data () {
            return {
              active: '1',
              model: 'true',
              betDownShow: '-1',
              chooseBet: [],
              selectedItem: 0,
              betRows: [
                  {num: [1], odds: 2.394},
                  {num: [2], odds: 2.394},
                  {num: [3], odds: 2.394},
                  {num: [4], odds: 2.394},
                  {num: [5], odds: 2.394},
                  {num: [6], odds: 2.394},
                  {word: "总和大", odds: 2.394},
                  {word: "总和小", odds: 2.394},
                  {word: "总和单", odds: 2.394},
                  {word: "总和双", odds: 2.394}
              ],
              betRows2: [
                {num: [1, 2, 5], odds: 2.39},
                {num: [1, 2, 5], odds: 2.39},
                {num: [1, 2, 5], odds: 2.39},
                {num: [1, 2, 5], odds: 2.39},
                {num: [1, 2, 5], odds: 2.39},
                {num: [1, 2, 5], odds: 2.39},
                {word: "全毂", odds: 25}
              ],
              lastLotts: [2, 3, 4],
              lastLottList: [
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'},
                {'nper': '20190809', 'time': '12:00:34', 'lastLotts': [2, 3, 6], 'sum': '11'}
              ],
              yilouList: [{}, {}, {}, {}]
            }
        },
        methods: {
          changeModel(model){
            this.model = model
          },
          betInput(index){
            if(this.betDownShow == index){
              this.betDownShow = -1
            }else {
              this.betDownShow = index
            }
          },
          // 取消
          cancelBet(){
            this.chooseBet = [];
            this.chooseBet = [];
            this.selectedItem = 0;
            this.$refs.threeBigSmall.choose = []
            this.$refs.rollOrRolls.choose = []
          },

          chooseBetNum(choose, flag){
            // TODO
            let threeList = this.$refs.threeBigSmall.choose
            let rollList = this.$refs.rollOrRolls.choose

            this.chooseBet = [...threeList, ...rollList]
          },
          selectedItemClick(itemNum){
            this.selectedItem = itemNum
          }
        },
        created () {}
    }
</script>

<style lang="less" scoped>

  #root{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
    background-color: #fff;
    overflow: hidden;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
  }


  .bet_1{
    -webkit-animation-duration: .25s!important;
    animation-duration: .25s!important;
    -ms-flex: 1 1;
    flex: 1 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;

    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
    height: auto;

    .tabPane{
      flex: 1 1;
      /*height: 100%;*/
      height: 400px;
      overflow-y: scroll;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
    }
  }

  .bet_1_mode2{
    .yilou{
      height: 100%;
      overflow-x: hidden;
      overflow-y: auto;
      font-size: 14px;

      .space{
        height: 20px;
        background-color: #f2f2f2;
        -webkit-box-shadow: 0 1px 2px #d5d5d5;
        box-shadow: 0 1px 2px #d5d5d5;
      }

      .item_wrap{
        border-bottom: 1px solid #d5d5d5;

        .up{
          display: flex;
          -ms-flex-pack: end;
          justify-content: flex-end;
          -ms-flex-align: center;
          align-items: center;
          -webkit-box-sizing: border-box;
          box-sizing: border-box;
          padding: 0 20px;
          height: 48px;

          .show_name{
            overflow: hidden;
            -o-text-overflow: ellipsis;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
          .off_count{
            flex: 1 1;
            margin: 0 20px;
            text-align: right;
            white-space: nowrap;
            overflow: hidden;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            padding-right: 20px;

            .n{
              color: #661dac;
              font-size: 12px;
              margin-right: 4px;
              white-space: nowrap;
              display: inline-block;

            }
          }

          .btn{
            width: 64px;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            display: -ms-flexbox;
            display: flex;
            -ms-flex-pack: center;
            justify-content: center;
            -ms-flex-align: center;
            align-items: center;
            padding: 9px 12px;
            background-color: #fff;
            font-size: 14px;
            font-weight: 500;
            -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.3);
            box-shadow: 0 1px 4px rgba(0,0,0,.3);
            white-space: nowrap;
            border: 1px solid transparent;
            border-radius: 12px;
            color: #333;
          }
        }

        .down{
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: justify;
          justify-content: space-between;
          -ms-flex-align: center;
          align-items: center;
          -webkit-box-sizing: border-box;
          box-sizing: border-box;
          padding: 0 20px;
          background-color: #f2f2f2;
          white-space: nowrap;
          overflow: hidden;
          height: 48px;
          -webkit-transition: height .1s;
          -o-transition: height .1s;
          transition: height .1s;

          .odds .n{
            color: #f45300;
            font-size: 14px;
            margin-left: 4px;
          }

          .input{
            width: 90px;
            text-align: center;
            font-size: 12px;
            height: 40px;
            background-color: transparent;
            border-bottom: 1px solid #661dac;
          }

          .btn_wrap{
            display: flex;

            .btn1{
              width: 64px;
              -webkit-box-sizing: border-box;
              box-sizing: border-box;
              border: 1px solid #baa0ed;
              display: -ms-flexbox;
              display: flex;
              -ms-flex-pack: center;
              justify-content: center;
              -ms-flex-align: center;
              align-items: center;
              padding: 6px 16px;
              background-color: #f1eaff;
              border-radius: 100px;
              font-size: 14px;
              background-color: #fff;
              color: #661dac;
            }

            .btn2{

              width: 3.2rem;
              -webkit-box-sizing: border-box;
              box-sizing: border-box;
              border: 1px solid #baa0ed;
              display: -ms-flexbox;
              display: flex;
              -ms-flex-pack: center;
              justify-content: center;
              -ms-flex-align: center;
              align-items: center;
              padding: .3rem .8rem;
              background-color: #f1eaff;
              border-radius: 100px;
              font-size: 14px;
              background-color: #fff;

              background-color: #8454e4;
              color: #fff;
              margin-left: 12px;
            }
          }
        }
      }
    }
  }

  .footer_ct{
    -webkit-box-shadow: 0 -1px 3px rgba(0,0,0,.19);
    box-shadow: 0 -1px 3px rgba(0,0,0,.19);
    overflow: hidden;

    .default{
      display: flex;
      align-items: center;
      height: 60px;
      width: 100%;
      -ms-flex-align: center;
      -webkit-animation-duration: .5s!important;
      animation-duration: .5s!important;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      padding: 0 28px;
    }

    .default .left{
      height: 100%;
      -ms-flex: 1 1;
      flex: 1 1;
      -ms-flex-pack: center;
      justify-content: center;
      -ms-flex-align: center;
      color: #9d9d9d;
      margin-right: 40px;
      display: flex;
      align-items: center;

      .need_login{
        color: #8454e4;
        text-decoration: underline;
      }

      .balance_wrap{
        flex: 1 1;
        white-space: nowrap;

        .balance{
          width: 100%;
          font-size: 13px;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: start;
          justify-content: start;
          -ms-flex-align: center;
          align-items: center;
          margin-bottom: 4px;

          .num{
            color: #ff6c2c;
          }
        }

        .win_lost{
          width: 100%;
          font-size: 13px;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: start;
          justify-content: start;
          -ms-flex-align: center;
          align-items: center;
          color: #661dac;

          .label{
            text-decoration: underline;
          }
        }
      }

      .refresh{
        margin-left: 12px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        border-radius: 100%;
        -webkit-box-shadow: 0 0 2px #000;
        box-shadow: 0 0 2px #000;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-pack: center;
        justify-content: center;
        -ms-flex-align: center;
        align-items: center;

        .img{
          height: 14px;
          width: 14px;
          margin: 2px;
        }
      }
    }


    .default .right{
      height: 42px;
      display: -ms-flexbox;
      display: flex;
      -ms-flex-align: center;
      align-items: center;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      flex: 1 1;
      -ms-flex-pack: end;
      justify-content: flex-end;
      position: relative;
      overflow: hidden;
      padding-right: 1px;
      width: 420px;

      .submit{
        width: 100%;
        border-radius: 100px;
        background-color: #ff7d2e;
        padding-left: 0px;
        color: #f5f5f5;
        font-size: 14px;
        height: 42px;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;


        .phone_shake{
          height: 100%;
        }
      }

      .shopping_cart{
        position: absolute;
        z-index: 1;
        right: 1px;
        top: 1px;
        width: 40px;
        height: 42px;
        border-radius: 100%;
        background-color: #fff;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-pack: center;
        justify-content: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.3);
        box-shadow: 0 1px 4px rgba(0,0,0,.3);

        .shop_purple{
          height: 50%;
          margin-top: 6px;
        }
      }
    }

    .active{
      overflow: hidden;
      height: 160px;
      -webkit-transition: height .4s;
      -o-transition: height .4s;
      transition: height .4s;

      .message{
        display: flex;
        -ms-flex-align: center;
        align-items: center;
        height: 28px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;

        .order_message{
          flex: 3 1;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-align: center;
          align-items: center;
          -ms-flex-pack: center;
          justify-content: center;
        }

        .account_message{
          flex: 4 1;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-align: center;
          align-items: center;
          color: #9d9d9d;
        }
      }

      .tool{
        display: flex;
        -ms-flex-align: center;
        align-items: center;

        height: 50px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        -ms-flex-pack: justify;
        justify-content: space-between;
        border-top: 1px solid #d8d8d8;
        border-bottom: 1px solid #d8d8d8;

        .edit{
          background-color: #f1eaff;
          width: 36px;
          height: 100%;
          -ms-flex-pack: center;
          justify-content: center;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-align: center;
          align-items: center;

          .icon{
            height: 40%;
          }

          .shortcut_editor{
            position: fixed;
            z-index: 1000;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: rgba(0,0,0,.5);
            display: -ms-flexbox;
            display: flex;
            -ms-flex-direction: column;
            flex-direction: column;
            -ms-flex-pack: end;
            justify-content: flex-end;

            .editor{
              background-color: #fff;

              .top{
                height: 60px;
                display: -ms-flexbox;
                display: flex;
                -ms-flex-align: center;
                align-items: center;
                -webkit-box-sizing: border-box;
                box-sizing: border-box;
                padding: 0 20px;

                .shortcut_amount{
                  height: 100%;
                  -ms-flex: 1 1;
                  flex: 1 1;
                  color: #661dac;
                  -ms-flex-align: center;

                  .item{
                    display: flex;
                    -ms-flex-pack: center;
                    justify-content: center;
                    -ms-flex-align: center;
                    align-items: center;

                    .input{
                      -webkit-appearance: initial;
                      text-align: center;
                      width: 40px;
                      height: 34px;
                      -webkit-box-sizing: border-box;
                      box-sizing: border-box;
                      border-radius: 8px;
                      -webkit-box-shadow: 0 0 1px #661dac;
                      box-shadow: 0 0 1px #661dac;
                      color: #661dac;
                    }
                  }
                }
              }

              .tips{
                border-bottom: 1px solid #d8d8d8;
                text-align: center;
                font-size: 13px;
                color: #666;
                padding-bottom: .2rem;
              }

              .bottom{
                height: 64px;
                display: -ms-flexbox;
                display: flex;
                -ms-flex-pack: justify;
                justify-content: space-between;
                -ms-flex-align: center;
                align-items: center;
                -webkit-box-sizing: border-box;
                box-sizing: border-box;
                padding: 0 108px;

                .cancel{
                  width: 68px;
                  height: 34px;
                  display: -ms-flexbox;
                  display: flex;
                  -ms-flex-pack: center;
                  justify-content: center;
                  -ms-flex-align: center;
                  align-items: center;

                  border-radius: 100px;
                  color: #661dac;
                  border: 1px solid #baa0ed;
                }

                .conform{
                  width: 68px;
                  height: 34px;
                  -ms-flex-pack: center;
                  justify-content: center;
                  border-radius: 100px;
                  color: #fdfdfd;
                  background-color: #8454e4;
                  display: flex;
                  -ms-flex-align: center;
                  align-items: center;
                }
              }
            }
          }
        }

        .content{
          flex: 1 1;
          color: #661dac;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: justify;
          justify-content: space-between;
          -ms-flex-align: center;
          align-items: center;
          -webkit-box-sizing: border-box;
          box-sizing: border-box;
          padding: 0 10px;

          .item{
            width: 40px;
            height: 34px;
            display: -ms-flexbox;
            display: flex;
            -ms-flex-pack: center;
            justify-content: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-box-shadow: 0 0 4px rgba(0,0,0,.3);
            box-shadow: 0 0 4px rgba(0,0,0,.3);
            color: #661dac;
          }

          .item_act{
            width: 40px;
            height: 34px;
            display: -ms-flexbox;
            display: flex;
            -ms-flex-pack: center;
            justify-content: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-box-shadow: 0 0 4px rgba(0,0,0,.3);
            box-shadow: 0 0 4px rgba(0,0,0,.3);
            color: #661dac;
            border-radius: 8px;
            border: 1px solid #8454e4;
            background-color: #f1eaff;
          }
        }

        .add{
          background-color: #f1eaff;
          width: 68px;
          height: 100%;
          -ms-flex-pack: center;
          justify-content: center;
          color: #661dac;
          display: flex;
          -ms-flex-align: center;
          align-items: center;
        }
      }

      .bar{
        height: 52px;
        -ms-flex-pack: justify;
        justify-content: space-between;
        font-size: 14px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        padding: 0 20px;
        display: flex;
        -ms-flex-align: center;
        align-items: center;

        .input_wrap{
          height: 100%;
          width: 160px;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: center;
          justify-content: center;
          -ms-flex-align: center;
          align-items: center;
          color: #333;

          .input{
            border-bottom: 1px solid #661dac;
            width: 80px;
            height: 24px;
            text-align: center;
            color: #3f3f3f;
          }
        }
        .clean{
          border: 1px solid #baa0ed;
          border-radius: 100px;
          color: #661dac;
          width: 68px;
          height: 34px;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: center;
          justify-content: center;
          -ms-flex-align: center;
          align-items: center;
        }

        .submit{
          width: 68px;
          height: 34px;
          display: -ms-flexbox;
          display: flex;
          -ms-flex-pack: center;
          justify-content: center;
          -ms-flex-align: center;
          align-items: center;
          background-color: #8454e4;
          border-radius: 100px;
          color: #fdfdfd;
        }
      }
    }
  }
</style>
